package com.zdsoft.finance.meet.repository;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.zdsoft.finance.common.base.CustomRepository;
import com.zdsoft.finance.meet.entity.MeetingProject;

/**
 * 上会项目Repository
 * 
 * @author liuwei
 *
 */
public interface MeetingProjectRepository extends CustomRepository<MeetingProject, String> {

	/**
	 * 通过ids查询上会项目集合
	 * 
	 * @param ids
	 *            ids
	 * @return 上会项目集合
	 */
	public List<MeetingProject> findByIdIn(Collection<String> ids);

	/**
	 * 通过会议id查询分页上会项目
	 * 
	 * @param pageable
	 *            分页信息
	 * @param meetingId
	 *            会议id
	 * @return 分页上会项目信息
	 */
	@Query(" from MeetingProject e where e.isDeleted = 0 and e.meeting.id = :meetingId ")
	public Page<MeetingProject> findByMeetingId(Pageable pageable, @Param("meetingId") String meetingId);

	/**
	 * 通过会议id查询上会项目集合
	 * 
	 * @param meetingId
	 *            会议id
	 * @return 上会项目集合
	 */
	@Query(" from MeetingProject e where e.isDeleted = 0 and e.meeting.id = :meetingId ")
	public List<MeetingProject> findByMeetingId(@Param("meetingId") String meetingId);

	/**
	 * 通过查询条件查询分页上会项目
	 * 
	 * @param pageable
	 *            分页信息
	 * @param conditions
	 *            查询条件集合Map
	 * @return 分页上会项目
	 */
	public Page<MeetingProject> findByConditions(Pageable pageable, Map<String, Object> conditions);

	/**
	 * 通过流程业务id查找上会项目
	 * 
	 * @param businessId
	 *            流程业务id
	 * @return 上会项目
	 */
	public MeetingProject findByBusinessId(String businessId);
}
